<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title><?php echo $app->trans('app.name') ?></title>

        <!-- Fonts -->

        <?php echo $app->renderView('blocks/fonts.html'); ?>

        <!-- Styles -->

        <link rel="icon" type="image/icon" href="<?php echo $app->asset('img/fav.ico') ?>">

        <link rel="stylesheet" href="<?php echo $app->asset('css/jquery.mCustomScrollbar.css') ?>" />
        <link rel="stylesheet" href="<?php echo $app->asset('css/main.css') ?>" />
        <link rel="stylesheet" href="<?php echo $app->asset('css/admin.css') ?>" />
        <link rel="stylesheet" href="<?php echo $app->asset('css/bootstrap-popover.css') ?>" />
        <link rel="stylesheet" href="<?php echo $app->asset('css/bootstrap.css') ?>" />
        <link rel="stylesheet" href="<?php echo $app->asset('css/colorpicker.css') ?>" />
        <link rel="stylesheet" href="<?php echo $app->asset('css/ui-lightness/jquery-ui-1.10.3.custom.css') ?>" />
    </head>
    <body>
        <div id="customer-chat" class="customer-chat customer-chat-admin">
            <div class="customer-chat-header">
                <div class="customer-chat-header-title">
                    <img src="<?php echo $app->asset('img/logo-white-small.png') ?>" />
                    <?php echo $app->trans('app.name') ?>
                </div>
                <div id="customer-chat-button-menu" class="customer-chat-header-button">
                    <div class="customer-chat-content-message-avatar-operator"></div>
                    <div class="customer-chat-header-button-text"></div>
                    <i class="icon-chevron-down icon-white"></i>
                </div>

                <div class="customer-chat-header-menu">
                    <div class="customer-chat-header-menu-triangle"></div>

                    <a href="#" id="customer-chat-header-menu-edit" class="customer-chat-header-menu-item" data-id="0"><i class="icon-user"></i> <div><?php echo $app->trans('edit.profile') ?></div></a>
                    <a href="<?php echo $app->path('Install:index') ?>" id="customer-chat-header-menu-install" class="customer-chat-header-menu-item"><i class="icon-chevron-right"></i> <div><?php echo $app->trans('install') ?></div></a>
                    <?php if($vars["installed"]) { ?>
                    <a href="<?php echo $app->path('Install:wizard') ?>" id="customer-chat-header-menu-edit-config" class="customer-chat-header-menu-item"><i class="icon-chevron-right"></i> <div><?php echo $app->trans('edit.config') ?></div></a>
                    <?php } ?>
                    <a href="<?php echo $app->path('Install:uninstall') ?>" id="customer-chat-header-menu-uninstall" class="customer-chat-header-menu-item"><i class="icon-remove"></i> <div><?php echo $app->trans('uninstall') ?></div></a>
                    <a href="#" id="customer-chat-header-menu-logs" class="customer-chat-header-menu-item"><i class="icon-info-sign"></i> <div><?php echo $app->trans('logs') ?></div></a>
                    <a href="<?php echo $app->path('Admin:widgetTest') ?>" id="customer-chat-header-menu-widget-test" class="customer-chat-header-menu-item" target="_blank"><i class="icon-eye-open"></i> <div><?php echo $app->trans('widget.preview') ?></div></a>
                    <a href="#" id="customer-chat-header-menu-widget-snippet" class="customer-chat-header-menu-item"><i class="icon-align-left"></i> <div><?php echo $app->trans('widget.get') ?></div></a>
                    <a href="<?php echo $app->path('Authentication:logout') ?>" class="customer-chat-header-menu-item"><i class="icon-off"></i> <div><?php echo $app->trans('logout') ?></div></a>
                </div>
            </div>

            <div class="customer-chat-content">
                <div class="customer-chat-side-menu">
                    <a href="#" id="customer-chat-side-button-chat" class="customer-chat-side-menu-item"><i class="icon-comment icon-white"></i></a>
                    <!--<a href="#" id="customer-chat-side-button-map" class="customer-chat-side-menu-item"><i class="icon-map-marker icon-white"></i></a>-->
                    <a href="#" id="customer-chat-side-button-settings" class="customer-chat-side-menu-item"><i class="icon-wrench icon-white"></i></a>
                    <a href="#" id="customer-chat-side-button-logs" class="customer-chat-side-menu-item"><i class="icon-info-sign icon-white"></i></a>
                    <a title="Widget preview" href="<?php echo $app->path('Admin:widgetTest') ?>" id="customer-chat-side-button-widget-test" class="customer-chat-side-menu-item" target="_blank"><i class="icon-eye-open icon-white"></i></a>
                    <a title="Get widget script" href="#" id="customer-chat-side-button-widget-snippet" class="customer-chat-side-menu-item"><i class="icon-align-left icon-white"></i></a>
                    <a title="Logout" href="<?php echo $app->path('Authentication:logout') ?>" class="customer-chat-side-menu-item"><i class="icon-off icon-white"></i></a>

                    <div class="customer-chat-side-menu-triangle"></div>
                </div>

                <div class="customer-chat-content-wrapper">
                    <div id="customer-chat-admin-chat"></div>

                    <div id="customer-chat-admin-map">
                        <div class="map-wrapper"></div>
                        <div class="no-key-info">
                            <p><?php echo $app->trans('map.no.api.key.info') ?></p>
                        </div>
                    </div>

                    <div id="customer-chat-admin-settings">

                        <!-- Tabs -->

                        <div class="customer-chat-tabs">
                            <a href="#" class="customer-chat-tab customer-chat-tab-prev"><i class="icon-chevron-left"></i></a>
                            <div class="customer-chat-tabs-wrapper">
                                <a data-tag="operators" href="#" class="customer-chat-tab customer-chat-tab-button operators"><i class="fa fa-user"></i> <span><?php echo $app->trans('operators') ?></span></a>
                                <a data-tag="departments" href="#" class="customer-chat-tab customer-chat-tab-button departments"><i class="fa fa-cubes"></i> <?php echo $app->trans('departments') ?></a>
                                <a data-tag="canned-messages" href="#" class="customer-chat-tab customer-chat-tab-button canned-messages"><i class="fa fa-comments"></i> <?php echo $app->trans('canned.messages') ?></a>
                                <a data-tag="history" href="#" class="customer-chat-tab customer-chat-tab-button"><i class="fa fa-search"></i> <?php echo $app->trans('history') ?></a>
                                <a data-tag="widget-theme" href="#" class="customer-chat-tab customer-chat-tab-button widget-theme"><i class="fa fa-eyedropper"></i> <?php echo $app->trans('widget.settings') ?></a>
                                <a data-tag="blacklist" href="#" class="customer-chat-tab customer-chat-tab-button"><i class="fa fa-ban"></i> <?php echo $app->trans('widget.blacklist') ?></a>
                                <a data-tag="settings" href="#" class="customer-chat-tab customer-chat-tab-button customer-chat-active"><i class="fa fa-wrench"></i> <?php echo $app->trans('settings') ?></a>
                            </div>
                            <a href="#" class="customer-chat-tab customer-chat-tab-next"><i class="icon-chevron-right"></i></a>
                        </div>

                        <!-- Tabs contents -->

                        <div data-tag="operators" id="customer-chat-operators-tab" class="customer-chat-tab-content"></div>
                        <div data-tag="departments" id="customer-chat-departments-tab" class="customer-chat-tab-content"></div>
                        <div data-tag="canned-messages" id="customer-chat-canned-messages-tab" class="customer-chat-tab-content"></div>
                        <div data-tag="history" id="customer-chat-history" class="customer-chat-tab-content customer-chat-tab-content-settings customer-chat-tab-content-history"></div>
                        <div data-tag="widget-theme" id="customer-chat-widget-theme-tab" class="customer-chat-tab-content customer-chat-tab-content-settings customer-chat-tab-content-settings-ui customer-chat-tab-content-widget-theme"></div>
                        <div data-tag="blacklist" id="customer-chat-pages-list" class="customer-chat-tab-content customer-chat-tab-content-pages-list"></div>
                        <div data-tag="settings" class="customer-chat-tab-content customer-chat-tab-content-settings customer-chat-tab-content-settings-ui"></div>

                    </div>

                    <!-- Logs -->

                    <div id="customer-chat-admin-logs"></div>

                    <!-- /Logs -->
                </div>
            </div>
        </div>

        <!-- Templates -->

        <?php echo $app->renderView('js-templates/common.html'); ?>
        <?php echo $app->renderView('js-templates/admin.html', $vars); ?>

        <!-- Scripts -->

        <?php echo $app->renderView('blocks/debugScripts.html'); ?>

        <?php if($app->env == 'prod') { ?>

            <script src="<?php echo $app->asset('js/customer-chat-admin-libs.min.js') ?>" type="text/javascript"></script>
        <?php } else { ?>
            <!--[if lte IE 9]>
            <script type="text/javascript" src="<?php echo $app->asset('js/lib/es5-shim.min.js') ?>"></script>
            <![endif]-->
            <script src="<?php echo $app->asset('js/lib/jquery.js') ?>"></script>
            <!--[if lte IE 9]>
            <script type="text/javascript" src="<?php echo $app->asset('js/lib/placeholders.jquery.min.js') ?>"></script>
            <![endif]-->

            <script src="<?php echo $app->asset('js/lib/jquery.extramouse.js') ?>"></script>
            <script src="<?php echo $app->asset('js/lib/jquery.cookie.js') ?>"></script>
            <script src="<?php echo $app->asset('js/lib/jquery.ui.min.js') ?>"></script>
            <script src="<?php echo $app->asset('js/lib/jquery.mousewhell.js') ?>"></script>
            <script src="<?php echo $app->asset('js/lib/jquery.displayevents.js') ?>"></script>
            <script src="<?php echo $app->asset('js/lib/jquery.mCustomScrollbar.js') ?>"></script>
            <script src="<?php echo $app->asset('js/lib/colorpicker.js') ?>"></script>
            <script src="<?php echo $app->asset('js/lib/bootstrap-popover.min.js') ?>"></script>
            <script src="<?php echo $app->asset('js/lib/jQuery.AjaxFileUpload.js') ?>"></script>
            <script src="<?php echo $app->asset('js/lib/AjaxUploader.js') ?>"></script>
            <script src="<?php echo $app->asset('js/lib/json2.js') ?>"></script>
            <script src="<?php echo $app->asset('js/lib/qrcode.js') ?>"></script>
            <script src="<?php echo $app->asset('js/lib/underscore.js') ?>"></script>
            <script src="<?php echo $app->asset('js/lib/handlebars.js') ?>"></script>
            <script src="<?php echo $app->asset('js/lib/backbone.js') ?>"></script>
            <script src="<?php echo $app->asset('js/lib/backbone.marionette.js') ?>"></script>
            <script src="<?php echo $app->asset('js/lib/soundmanager2-nodebug-jsmin.js') ?>"></script>
            <script src="<?php echo $app->asset('js/lib/desktop-notify.min.js') ?>"></script>
        <?php } ?>

        <script type="text/javascript">
            // Basic configuration

            window.chatConfig = {

                serverTimeDifference : (new Date('<?php echo date("Y-m-d H:i:s") ?>'.replace(/-/g,"/")).getTime() / 1000) - (new Date().getTime() / 1000),

                rootPath : '<?php echo $app->asset("") ?>',

                installPath              : '<?php echo $app->path("Install:index") ?>',
                installWizardPath        : '<?php echo $app->path("Install:wizard") ?>',
                isOperatorOnlinePath     : '<?php echo $app->path("Operator:isOnline") ?>',
                isLoggedInPath           : '<?php echo $app->path("Authentication:isGuestLoggedIn") ?>',
                loginPath                : '<?php echo $app->path("Authentication:loginGuest") ?>',
                lastMessagesPath         : '<?php echo $app->path("Message:operatorGuestGetLast") ?>',
                sendMessagePath          : '<?php echo $app->path("Message:send") ?>',
                uploadCrudPath           : '<?php echo $app->path("Upload:crud") ?>',
                uploadFilesPath          : '<?php echo $app->path("Upload:upload") ?>',
                denyUploadPath           : '<?php echo $app->path("Upload:deny") ?>',
                confirmUploadPath        : '<?php echo $app->path("Upload:confirm") ?>',
                abortUploadPath          : '<?php echo $app->path("Upload:abort") ?>',
                downloadFilePath         : '<?php echo $app->path("SharedFile:download") ?>',
                queryHistoryPath         : '<?php echo $app->path("Message:queryHistory") ?>',
                clearHistoryPath         : '<?php echo $app->path("Message:clearHistory") ?>',
                manageConnectionPath     : '<?php echo $app->path("Operator:manageConnection") ?>',
                getTypingStatusPath      : '<?php echo $app->path("Operator:getTypingStatus") ?>',
                updateTypingStatusPath   : '<?php echo $app->path("Operator:updateTypingStatus") ?>',
                getOnlineUsersPath       : '<?php echo $app->path("Operator:getOnlineUsers") ?>',
                inviteToTalkPath         : '<?php echo $app->path("Operator:inviteToTalk") ?>',
                leaveTalkPath            : '<?php echo $app->path("Operator:leaveTalk") ?>',
                closeTalkPath            : '<?php echo $app->path("Operator:closeTalk") ?>',
                transferTalkPath         : '<?php echo $app->path("Operator:transferTalk") ?>',
                getOperatorPath          : '<?php echo $app->path("Operator:get") ?>',
                getUserPath              : '<?php echo $app->path("Operator:get") ?>',
                getUsersPath             : '<?php echo $app->path("Operator:getUsers") ?>',
                listOperatorsPath        : '<?php echo $app->path("Operator:list") ?>',
                saveOperatorPath         : '<?php echo $app->path("Operator:update") ?>',
                uploadAvatarPath         : '<?php echo $app->path("Operator:uploadAvatar") ?>',
                deleteOperatorPath       : '<?php echo $app->path("Operator:delete") ?>',
                createCannedMessagesPath : '<?php echo $app->path("CannedMessage:create") ?>',
                getCannedMessagePath     : '<?php echo $app->path("CannedMessage:get") ?>',
                listCannedMessagesPath   : '<?php echo $app->path("CannedMessage:list") ?>',
                updateCannedMessagePath  : '<?php echo $app->path("CannedMessage:update") ?>',
                deleteCannedMessagePath  : '<?php echo $app->path("CannedMessage:delete") ?>',
                createDepartmentPath     : '<?php echo $app->path("Department:create") ?>',
                getDepartmentPath        : '<?php echo $app->path("Department:get") ?>',
                listDepartmentsPath      : '<?php echo $app->path("Department:list") ?>',
                updateDepartmentPath     : '<?php echo $app->path("Department:update") ?>',
                deleteDepartmentPath     : '<?php echo $app->path("Department:delete") ?>',
                contactPath              : '<?php echo $app->path("Contact:contact") ?>',
                getSettingsPath          : '<?php echo $app->path("Config:getSettings") ?>',
                updateSettingsPath       : '<?php echo $app->path("Config:updateSettings") ?>',
                resetSettingsPath        : '<?php echo $app->path("Config:resetSettings") ?>',
                getLogsPath              : '<?php echo $app->path("Admin:logs") ?>',
                clearLogsPath            : '<?php echo $app->path("Admin:clearLogs") ?>',
                updateBlacklistPath      : '<?php echo $app->path("Admin:updateBlacklist") ?>',
                widgetInitPath           : '<?php echo $app->url("Widget:init", false) ?>',
                widgetInitInlinePath     : '<?php echo $app->url("Widget:initInline", false) ?>',
                trackLoginPath           : '<?php echo $app->path("OnlineGuests:login") ?>',

                installStatus : <?php echo $vars["installStatus"] ?>,

                messageSounds : <?php echo $vars['messageSounds'] ?>,

                languages : <?php echo $vars["languages"] ?>,
                trans     : <?php echo $vars["trans"] ?>,

                ui : <?php echo $vars["uiJson"] ?>,

                widgetThemes : <?php echo $vars["widgetThemes"] ?>,

                defaultAvatars : <?php echo $vars["defaultAvatars"] ?>,

                mapMarkerPath : '<?php echo $app->asset("img/marker-2.png") ?>',

                qrCode : <?php echo $vars["qrCode"] ?>
            };

            // Logged-in user info

            window.userData = <?php echo $vars["userData"] ?>;
        </script>

        <?php if($app->env == 'prod') { ?>
            <script src="<?php echo $app->asset('js/customer-chat-admin.min.js') ?>" type="text/javascript"></script>
        <?php } else { ?>
            <script src="<?php echo $app->asset('js/app/Application.js') ?>"></script>

            <script src="<?php echo $app->asset('js/app/service/SoundPlayer.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/service/Notify.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/service/I18n.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/service/QR.js') ?>"></script>

            <script src="<?php echo $app->asset('js/app/model/UISettingsModel.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/model/LogsModel.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/model/DepartmentsModel.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/model/CannedMessagesModel.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/model/AdminSettingsModel.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/model/MessageModel.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/model/SharedFileModel.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/model/UploadModel.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/model/UserModel.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/model/ChatViewModel.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/model/AdminChatModel.js') ?>"></script>

            <script src="<?php echo $app->asset('js/app/collection/WatchedUploadsCollection.js') ?>"></script>

            <script src="<?php echo $app->asset('js/app/controller/ActionController.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/controller/UploadController.js') ?>"></script>

            <script src="<?php echo $app->asset('js/app/view/AvatarView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/MessageView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/message/MessageImageView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/message/MessageVideoView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/message/MessageFileView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/ChatBoxView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/OnlineUsersItemView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/ParticipantView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/TabsView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/MenuView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/ChatTabView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/MapView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/FileDropZoneView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/ChatView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/input/InputView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/input/TextInputView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/input/CheckboxInputView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/input/SelectInputView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/input/SoundInputView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/input/WidgetThemeInputView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/input/ColorInputView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/SettingsView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/QRCodeView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/LogsView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/OperatorsView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/CannedMessagesView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/BlacklistView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/WidgetCodeView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/SelectAvatarView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/SelectCannedMessageView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/SelectUserView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/SelectListView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/DepartmentsView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/TransferAndLeaveView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/HistoryView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/WindowView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/admin/DialogsView.js') ?>"></script>
            <script src="<?php echo $app->asset('js/app/view/UserInfoPopoverView.js') ?>"></script>

            <script src="<?php echo $app->asset('js/admin.js') ?>"></script>
        <?php } ?>

    </body>
</html>
